package com.example.hyw.szysteam.view;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.example.hyw.szysteam.POJO.CLassMember;
import com.example.hyw.szysteam.R;
import com.example.hyw.szysteam.adapter.ClassMemberAdapter;
import com.example.hyw.szysteam.presenter.ClassMemberPresenter;

import java.util.ArrayList;

/**
 * Created by HYW on 2018/6/8.
 */

public class ClassMemberFragment extends Fragment {
    View view;
    ListView classMember;
    ClassMemberAdapter classMemberAdapter;
    String classId;
    private ClassMemberPresenter classMemberPresenter=new ClassMemberPresenter(this);

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        view=inflater.inflate(R.layout.fragment_classmember,container,false);
        return view;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        classId=getArguments().getString("classid");
        classMemberPresenter.classMember(classId);
    }

    public void initListView(ArrayList<CLassMember> cLassMembers){
        classMember=view.findViewById(R.id.lv_classmember);
        classMemberAdapter=new ClassMemberAdapter(getContext(),R.layout.item_classmember,cLassMembers);
        classMember.setAdapter(classMemberAdapter);
    }
}
